
<style type="text/css">
.RbacModal {
	height: 300px;
	overflow: scroll;
}

span.error {
	background: no-repeat;
	float: left;
	margin-left: 3em;
	clear: both;
	color: red;
}
</style>
<!-- 增加操作窗口 -->
<div id="addOperationModal" class="modal fade " data-backdrop="static"
	tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
	aria-hidden="true" style="display: none">
	<form id="addOperationForm" style="margin: 0" id="dataForm"
		name="dataForm" method="post">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal"
				aria-hidden="true">×</button>
			<h3 id="myModalLabel">新增操作</h3>
		</div>
		<div class="modal-body" style="overflow: scroll; height: 300px;">
			<!--   <div >
      <span> 操作名称 </span>
      <input type="text" id="input-operation-name"></input>
    </div> -->
			<!-- <div class="input-group"> -->
			<table class="table table-bordered">
				<tbody>
					<tr>
						<td width="30%"><span> 操作标识</span></td>
						<td><input type="text" class="form-control wid200px"
							id="input-operation-code" name="code" value="GET"></td>
					</tr>
					<tr>
						<td width="30%"><span> 操作名称</span></td>
						<td><input type="text" class="form-control wid200px"
							id="input-operation-name" name="name"></td>
					</tr>

				</tbody>
			</table>



			<!-- </div> -->


		</div>
		<div class="modal-footer">
			<input type="button" value="创建操作" class="btn btn-primary"
				aria-hidden="true" onclick="addOperation()" />
			<button class="btn btn-common" data-dismiss="modal"
				aria-hidden="true">关闭</button>
		</div>
	</form>
</div>

<!-- 编辑操作窗口 -->
<div id="editOperationModal" class="modal fade" data-height="300"
	data-backdrop="static" tabindex="-1" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true"
	style="display: none;">
	<form id="editOperationForm" style="margin: 0" id="dataForm"
		name="dataForm" method="post" action="editOperation">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal"
				aria-hidden="true">×</button>
			<h3 id="myModalLabel">编辑操作</h3>
		</div>
		<div class="modal-body">
			<table class="table table-bordered">
				<tbody>
					<tr>
						<td width="30%"><span> 操作标识</span></td>
						<td><input type="text" class="form-control wid200px"
							id="ed-operation-code" name="code"></td>
					</tr>
					<tr>
						<td width="30%"><span> 操作名 </span></td>
						<td><input class="form-control wid200px" type="hidden"
							id="ed-operation-id" name="id"></input> <input
							class="form-control wid200px" type="text" id="ed-operation-name"
							name="name"></input></td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="modal-footer">

			<input type="button" value="保存" class="btn btn-primary"
				aria-hidden="true"
				onclick="checkAndSubmit('editOperationForm','ed-operation-name')" />
			<button class="btn btn-common" data-dismiss="modal"
				aria-hidden="true">关闭</button>
		</div>
	</form>
</div>

<!-- 
<script>

    function checkAndSubmit(formId,inputId){
      alert("ttt");
        var operationName = $("#"+inputId).val();
//        var params = {"operationName":operationName};
//        var url = "/mam/api/mam/operation/findByName"+"?operationName="+operationName;
        var url = "{{ctx}}/rbac/operation/isExist?name="+operationName;
        //验证该操作名是否存在
        $.ajax({
            url : url,
            type : 'GET',
            dataType : "json",
            success : function(result) {
                console.log(result);
                if(result.error){
                    bootbox.alert(result.error);
                }else{
                  
                  if( $("#editOperationForm").valid()){
                    $("#editOperationModal").modal("hide");
                    $("#"+formId).submit());
                  }
                }
            },
            error : function(e,error,xhr) {
                bootbox.alert("服务器繁忙，请稍后再试！");
                return;
            }
        });
    }
</script> -->